package com.ldl.origami.dao;

import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.ldl.origami.domain.Tutorial;
import com.ldl.origami.domain.TutorialExample;
import com.ldl.origami.domain.TutorialPage;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TutorialMapper {
    int countByExample(TutorialExample example);

    int deleteByExample(TutorialExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Tutorial record);

    int insertSelective(Tutorial record);

    List<Tutorial> selectByExampleWithBLOBs(TutorialExample example);

    List<Tutorial> selectByExample(TutorialExample example);

    Tutorial selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Tutorial record, @Param("example") TutorialExample example);

    int updateByExampleWithBLOBs(@Param("record") Tutorial record, @Param("example") TutorialExample example);

    int updateByExample(@Param("record") Tutorial record, @Param("example") TutorialExample example);

    int updateByPrimaryKeySelective(Tutorial record);

    int updateByPrimaryKeyWithBLOBs(Tutorial record);

    int updateByPrimaryKey(Tutorial record);

    /**
     * 分页查询
     *
     * @param pageBounds
     * @return
     */
    List<Tutorial> selectByPage(PageBounds pageBounds);

    /**
     * 排名前十的用户
     *
     * @return
     */
    List<String> selectTop10();

    /**
     * 分页查询我收藏的教程
     *
     * @param tutorialIds
     * @return
     */
    List<Tutorial> selectMyCollectionByPage(List<Integer> tutorialIds);

    /**
     * 分页查询我的教程
     *
     * @param tutorialPage
     * @return
     */
    List<Tutorial> selectMyTutorialsByPage(TutorialPage tutorialPage);
}